
cc.Class({
    extends: cc.Component,

    properties: {
        spf_block:{
            type: [cc.SpriteFrame],
            default: []
        }

    },

    // LIFE-CYCLE CALLBACKS:
    
    onLoad () {
        //锤子🔨特效
        this.isChuiZi = false;
        this.isTuya = false;
        this.isIndicate = false;

        //动画
        this.click_anim = this.node.getComponent(cc.Animation);
        this.state_anim = click_anim.getAnimationState("click_block"); 
    },
    init: function(_type){
        this.blockType = _type;
        this.star_isdestory = false;
        this.node.getComponent(cc.Sprite).spriteFrame = this.spf_block[ this.blockType];
    },

    start () {


    },
    set_IsChuiZZi: function(iscuizi){
        this.isChuiZi = iscuizi;
        if(this.isChuiZi){
            this.node.getChildByName("block_select").active = true;
        }else{
            this.node.getChildByName("block_select").active = false;
        }
    },
    get_IsChuiZZi: function(){
        return this.isChuiZi;
    },
    //涂鸦
    set_IsTuya: function(isTuya){
        this.isTuya = isTuya;
        if(this.isTuya){
            this.node.getChildByName("block_select").active = true;
        }else{
            this.node.getChildByName("block_select").active = false;
        }
    },
    get_IsTuya: function(){
        return this.isTuya;
    },
    //提示功能
    set_IsIndicate: function(isIndicate){
        this.isIndicate = isIndicate;
        if(this.isIndicate){
            this.node.getChildByName("block_select").active = true;
            this.click_anim.play("click_block");
        }else{
            this.node.getChildByName("block_select").active = false;
            if(this.state_anim.isPlaying){
                this.click_anim.setCurrentTime(0,"click_block");
                this.click_anim.stop("click_block");
            }
        }
    },
    get_IsIndicate: function(){
        return this.isIndicate;
    },

    // update (dt) {},
});
